package codetop.microsoft.T75;

/**
 * @Author: 18362
 * @Create: 2022-08-16 16:56:30 星期二
 */
class Solution {
    public void sortColors(int[] nums) {
        int[] cnt = new int[3];
        for (int i=0; i<nums.length; ++i)
            cnt[nums[i]]++;
        for (int i=0; i<cnt[0]; ++i)
            nums[i] = 0;
        for (int i=cnt[0]; i<cnt[0]+cnt[1]; ++i)
            nums[i] = 1;
        for (int i=cnt[0]+cnt[1]; i<nums.length; ++i)
            nums[i] = 2;
    }
}